from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView, SpectacularRedocView

from django.contrib import admin
from django.urls import include, path
from django.conf import settings
from django.conf.urls.static import static
from ctbloge.apps.accounts.views import OauthLoginView, OauthCallbackView
from ctbloge.apps.blog.views import dashboard

# 导入自定义的router

urlpatterns = [
                  # 后台管理
                  path('admin/', admin.site.urls),
                  # 文件上传
                  path("ckeditor5/", include('django_ckeditor_5.urls')),

                  # 导入自定义的router
                  path('api/', include([
                      path('accounts/', include('ctbloge.apps.accounts.urls')),
                      path('blog/', include('ctbloge.apps.blog.urls')),
                      path('cms/', include('ctbloge.apps.cms.urls')),
                      path('comments/', include('ctbloge.apps.comments.urls')),
                      path('resources/', include('ctbloge.apps.resources.urls')),
                      # 其他v1版本接口...
                      # OpenAPI 文档
                      # OpenAPI 模式路径
                      path('schema/', SpectacularAPIView.as_view(), name='schema'),
                      # Swagger 文档界面
                      path('docs/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
                      # Redoc 文档界面
                      path('redoc/', SpectacularRedocView.as_view(url_name='schema'), name='redoc'),
                      # 第三方登录
                      path('auth/login/<str:provider>/', OauthLoginView.as_view(), name='gitee-login'),
                      path('auth/callback/<str:provider>/', OauthCallbackView.as_view(), name='gitee-callback'),
                  ])),

              ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
